// HSS.Logging.ILog.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       ILog.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Logging
{
	#region Using Directives
	using System;
	using System.Diagnostics;
	using System.ServiceModel;
	#endregion

	#region ILog
	/// <summary>
	/// The Interface for Application Logging
	/// </summary>
	[ServiceContract(Namespace = "http://highspeed-solutions.net/Logging/v100")]
	public interface ILog
	{
		/// <summary>
		/// The LogType
		/// </summary>
		EventLogType LogType { get; }

		/// <summary>
		/// Save an attachment to a Database
		/// </summary>
		/// <param name="entryId">The Id of the pre-existing EventLog Entry to attach.</param>
		/// <param name="content">The Content of the Attachment.</param>
		/// <param name="fileName">The File Name associated with this attachment. Uses the extension of the file to determine the Content-Type.</param>
		/// <returns>The AttachmentID</returns>
		/// <exception cref="InvalidOperationException">You can only add attachments when the LogType is to Database.</exception>
		[OperationContract]
		int AttachFile(int entryId, byte[] content, string fileName);

		/// <summary>
		/// Save an attachment to a Database
		/// </summary>
		/// <param name="entryId">The Id of the pre-existing EventLog Entry to attach.</param>
		/// <param name="content">The Content of the Attachment.</param>
		/// <param name="contentType">The Mime Content-Type of the Attachment.</param>
		/// <param name="fileNameWithOutExtention">The File Name associated with this attachment with out the extension (.ext).</param>
		/// <param name="extensionWithDot">The File Extension associated with this attachment (.ext).</param>
		/// <returns>The AttachmentID</returns>
		/// <exception cref="InvalidOperationException">You can only add attachments when the LogType is set to Database.</exception>
		[OperationContract]
		int AttachContent(int entryId, byte[] content, string contentType, string fileNameWithOutExtention, string extensionWithDot);

		/// <summary>
		/// Truncate the Log, retaining the requested number of days
		/// </summary>
		/// <param name="daysToRetain">The number of days to retain</param>
		[OperationContract]
		void TruncateLog(int daysToRetain);

		/// <summary>
		/// Write an entry to a Log
		/// </summary>
		/// <param name="message">The message to write.</param>
		/// <param name="userName">The name of the person or program writing this message.</param>
		/// <param name="category">The category of the program that is writing this message.</param>
		/// <param name="xmlString">The Xml String to attach to this entry.</param>
		/// <param name="applicationName">The name of the application this entry is associated with.</param>
		/// <param name="referenceNumber">A reference number to associate with the entry.</param>
		/// <param name="eventType">The event type for the entry.</param>
		/// <exception cref="InvalidOperationException">Cannot write to the Log when it's closed.</exception>
		/// <returns>The id of the new entry</returns>
		[OperationContract]
		int WriteEvent(string message, string userName, string category, string xmlString, string applicationName, string referenceNumber, EventLogEntryType eventType);

		/// <summary>
		/// Write an entry to a Log
		/// </summary>
		/// <param name="entry">The Log Entry to write</param>
		/// <exception cref="InvalidOperationException">Cannot write to the Log when it's closed.</exception>
		/// <returns>The id of the new entry</returns>
		[OperationContract]
		int WriteEntry(LogEntry entry);
	}
	#endregion
}